********************************************************************************		
********************** Descriptives on stacked data ****************************
********************************************************************************	
	
	use "ZA6804_v6-0-0_processed_stacked_votechoice.dta", clear	

	*** tab left-authoritarian's vote choices 
		cmtab if obs_party!=2, choice(vote)
				
	*** mean of salience variables by vote choice	
		cmsummarize w7_mip_econ w7_mip_immi, choice(vote)

				
	*** FIGURE A7: perceived party positions on the issues, by voters of the party vs. others
		set scheme plottig
		label define vote 0 "voted for other party" 1 "voted for this party"
		label values vote vote
				
		* histogram 
			* economic position
		twoway (histogram w7_party_highertaxes_st if obs_party==1  & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_highertaxes_st if obs_party==1  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "lower taxes" 1 "higher benefits") legend(off) title(CDU/CSU) name(UNION, replace) nodraw
		twoway (histogram w7_party_highertaxes_st if obs_party==3  & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_highertaxes_st if obs_party==3  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "lower taxes" 1 "higher benefits") legend(off) title(SPD) name(SPD, replace) nodraw
		twoway (histogram w7_party_highertaxes_st if obs_party==4 & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_highertaxes_st if obs_party==4  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "lower taxes" 1 "higher benefits") legend(off) title(FDP) name(FDP, replace) nodraw
		twoway (histogram w7_party_highertaxes_st if obs_party==5  & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_highertaxes_st if obs_party==5  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "lower taxes" 1 "higher benefits") legend(off) title(Greens) name(Greens, replace) nodraw
		twoway (histogram w7_party_highertaxes_st if obs_party==6  & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_highertaxes_st if obs_party==6  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "lower taxes" 1 "higher benefits") legend(off) title(The Left) name(LEFT, replace) nodraw
		twoway (histogram w7_party_highertaxes_st if obs_party==7 & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_highertaxes_st if obs_party==7 & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "lower taxes" 1 "higher benefits") legend(off) title(AfD) name(AfD, replace) nodraw
				
		graph combine UNION SPD FDP Greens LEFT AfD, imargin(zero) ycommon xcommon cols(1) xsize(3) title("Perceived economic position") name(econ, replace) nodraw
		
			* position on immigration
		twoway (histogram w7_party_migrrestr_st if obs_party==1  & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_migrrestr_st if obs_party==1  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "facilitate" 1 "restrict") legend(off) title(CDU/CSU) name(UNION, replace) nodraw
		twoway (histogram w7_party_migrrestr_st if obs_party==3  & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_migrrestr_st if obs_party==3  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "facilitate" 1 "restrict") legend(off) title(SPD) name(SPD, replace) nodraw
		twoway (histogram w7_party_migrrestr_st if obs_party==4 & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_migrrestr_st if obs_party==4  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "facilitate" 1 "restrict") legend(off) title(FDP) name(FDP, replace) nodraw
		twoway (histogram w7_party_migrrestr_st if obs_party==5  & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_migrrestr_st if obs_party==5  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "facilitate" 1 "restrict") legend(off) title(Greens) name(Greens, replace) nodraw
		twoway (histogram w7_party_migrrestr_st if obs_party==6  & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_migrrestr_st if obs_party==6  & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "facilitate" 1 "restrict") legend(off) title(The Left) name(LEFT, replace) nodraw
		twoway (histogram w7_party_migrrestr_st if obs_party==7 & vote==1, color(red%30) disc percent) ///
                 (histogram w7_party_migrrestr_st if obs_party==7 & vote==0, color(green%30) disc percent), ///
				ylabel(0 20 40 60 80) xtitle(" ") xlabel(0 "facilitate" 1 "restrict") legend(off) title(AfD) name(AfD, replace) nodraw
				
		graph combine UNION SPD FDP Greens LEFT AfD, imargin(zero) ycommon xcommon cols(1) xsize(3) title("Perceived position on immigration") name(migr, replace) nodraw
		
			* combine graphs
			graph combine econ migr, iscale(*1.2) ysize(7) name(FigureA7, replace)

		
		
	*** FIGURE A8: descriptives on perceived left-right positions 
		recode obs_party (6=1 "The Left") (3=2 "SPD") (5=3 "Greens") (4=4 "FDP") (1=5 "CDU/CSU") (7=6 "AfD"), gen(obs_party_lrorder)
				
		* all respondents
		hist w7_party_lr, by(obs_party_lrorder, title("All left-authoritarians") note(" ")) xline(6) discrete percent xlabel(1/11) name(gr1, replace) nodraw
				
		* party voters
		hist w7_party_lr if vote==1, by(obs_party_lrorder, title("Left-authoritarians who voted for the party") note(" ")) xline(6) discrete percent xlabel(1/11) name(gr2, replace) nodraw
		
		graph combine gr1 gr2, iscale(*1) cols(1) imargin(small) name(perceivedLR, replace) ysize(6)